﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeRepositoryConsole.OOP
{
    /**
     * Because private means that the member is only visible in the containing class. 
     * Since a top-level class has no class containing it it cannot be private (or protected). 
     * (Internal or public are valid modifiers though).
     * What would you want private to mean on a top-level class?
     * Of course all modifiers apply to nested classes, i.e. a class defined within another class.
     * 
     * <seealso cref="https://stackoverflow.com/questions/7379679/error-elements-defined-in-a-namespace-cannot-be-explicitly-declared-as-private#"/>
     */


    /// <summary>
    /// Explicitly class Access
    /// </summary>
    public class ExplicitlyAccess
    {
        public int Id { get; set; }
        private string Name { get; set; }
        protected DateTime Birthday { get; set; }
        internal string Address { get; set; }

        /// <summary>
        /// Access is limited to the current assembly or types derived from the containing class.
        /// <see cref="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/accessibility-levels"/>
        /// </summary>
        protected internal int Height { get; set; }


        /// <summary>
        /// The default for nested types is private. In both cases the default (for classes) is unsealed.
        /// </summary>
        class NestClassAccess1 { }
        
        /// <summary>
        /// explicitly asscssibility level private
        /// </summary>
        private class NestClassAccess2 { }
    }

    /// <summary>
    /// The default for non-nested types is internal.
    /// <seealso cref="https://stackoverflow.com/questions/347242/default-class-accessibility-in-c-sharp"/>
    /// </summary>
    class DefaultClassAccess
    {
        public int Id { get; set; }
    }
}
